import router from '@/router'
import { setupStore } from '../store'
import type { App } from 'vue'
import { setupMock } from '@/mock'
import { setupPermission } from './permission'
import { setIcon } from '@/utils/dom'
import ico from '../assets/logo/favicon.ico'
export const setupApp = (app: App) => {
  const meta = document.createElement('meta')
  meta.name = 'naive-ui-style'
  document.head.appendChild(meta)
  // 设置ICO 图标
  setIcon(ico)

  // 挂载 Pinia
  setupStore(app)

  // 挂载 Router
  app.use(router)

  setupPermission()
  // dev 环境开启 Mockjs
  if (import.meta.env.DEV) {
    setupMock()
  }
}
